"""Lead contact Pydantic schemas."""

from __future__ import annotations

from pydantic import EmailStr, Field

from ..models.lead_contact import PreferredChannel
from ..schemas.base import ORMBase


class LeadContactBase(ORMBase):
    """Base LeadContact schema."""

    name: str = Field(..., min_length=1, max_length=100)
    email: EmailStr | None = None
    phone: str | None = Field(None, max_length=50)
    role: str = Field(..., min_length=1, max_length=100)
    preferred_channel: PreferredChannel = PreferredChannel.PHONE


class LeadContactCreate(LeadContactBase):
    """Schema for creating a lead contact."""

    lead_id: int


class LeadContactUpdate(ORMBase):
    """Schema for updating a lead contact."""

    name: str | None = Field(None, min_length=1, max_length=100)
    email: EmailStr | None = None
    phone: str | None = Field(None, max_length=50)
    role: str | None = Field(None, min_length=1, max_length=100)
    preferred_channel: PreferredChannel | None = None


class LeadContactOut(LeadContactBase):
    """Schema for lead contact output."""

    id: int
    lead_id: int
